﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wolfbyte.Core.Repositories;
using System.Data.Linq;

namespace Wolfbyte.UnitOfWork.LinqToSql
{
    public class LinqToSqlRepository<T> : IRepository<T> where T : class
    {
        private Table<T> Table;

        public LinqToSqlRepository(DataContext Context)
        {
            this.Table = Context.GetTable<T>();
        }

        #region IRepository<T> Members

        public IQueryable<T> Items
        {
            get { return Table; }
        }

        public void Add(T newItem)
        {
            Table.InsertOnSubmit(newItem);
        }

        #endregion
    }
}
